var MenuItemRender = new Class({
	"Extends":js.underas.controller.ListViewItemRender
	,"initialize":function(p_obj){	
		var htmlTmp = '<h4><span class="glyphicon glyphicon-'+p_obj.icone+'"></span>'+p_obj.label+'</h4>';
		htmlTmp += '<p class="list-group-item-text">ICONE:'+p_obj.icone+'</p>'; 
		htmlTmp += '<p class="list-group-item-text">ORDEM:'+p_obj.ordem+'</p>'; 
		this.parent('div',htmlTmp);
		this.getEle().addClass("col-xs-6 col-sm-4 col-md-4");
		}
	});



var Menu = new Class({
	"Extends":js.underas.container.ModWindow
	,"itIdMenu":null	 
	,"itLabel":null	 
	,"itIcone":null	 
	,"itOrdem":null	 
	,"initialize":function(){
		this.parent("*cadastro e configuracao dos menus.");
		this.setRevision("$Revision: 138 $");		
		this.setSize(8);

		this.itIdMenu = new js.underas.controller.InputText("");
		this.itIdMenu.setColumn("$idMenu");
		this.itIdMenu.setLabel("cod.");
		this.itIdMenu.setEnable(false);	
		this.itIdMenu.setSize(2);	

		this.itLabel = new js.underas.controller.InputText("");
		this.itLabel.setColumn("@label");
		this.itLabel.setLabel("label");
		this.itLabel.setSize(6);	

		this.itIcone = new js.underas.controller.InputText("");
		this.itIcone.setColumn("@icone");
		this.itIcone.setLabel("icone");
		this.itIcone.setSize(2);	

		this.itOrdem = new NumericStepper(0);
		this.itOrdem.setColumn("@ordem");
		this.itOrdem.setLabel("ordem");
		this.itOrdem.setSize(2);	
		
		this.mainList = new js.underas.controller.ListView("Menu");
		this.mainList.setItemRender("MenuItemRender");
		this.setMainList("mainList");
		this.mainTb = new js.underas.net.ToolBar({"domain":"menu.business.MenuBLL"});

		this.append(this.mainTb);
		this.append(this.itIdMenu);	
		this.append(this.itLabel);	
		this.append(this.itIcone);	
		this.append(this.itOrdem);	
		this.append(this.mainList);
		
		this.addAssociation({"mod":"br.net.atasacramental.menu.view.ItemMenu","act":"getByIdMenu","puid":this.getVarModule()});
		

	}
	,"onStart":function(){
		this.mainTb.activate(true);
	}
	,"getByIdMenu":function(p_idMenu){
		this.itIdMenu.setValue(p_idMenu);
		rm.addRequest({
			"puid":this.getVarModule()
			,"s":"menu.business.MenuBLL.getByIdMenu"
			,"p":p_idMenu
			,"onLoad":function(dta){
				menu.getMainList().setDataProvider(dta.rs);				
			}
		}); 
	}
});